<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="app">
        <h1>{{uname}}</h1>
        <h1>{{age}}</h1>
    </div>

    <script>
        //数据代理： 一个对象(vm)代理对另外一个对象(_data)属性(_data存放的所有的数据)的操作【读/写】。
        let vm = new Vue({
            el:"#app",
            data:{
                uname:"张三",
                age:18
            }
        })
        console.log(vm)

        Object.defineProperty(vm,"uname",{
            get(){
                return _data.uname;
            },
            set(value){
                _data.uname = value;
            }
        })

        Object.defineProperty(vm,"age",{
            get(){
                return _data.age;
            },
            set(value){
                _data.age = value;
            }
        })        
    </script>
</body>
</html>